import { get, post, put,service } from '@/utils/request';

export function getPageList(search){
    return get("menu/page",search)
}

export function getChildMenu(code){
    return get("menu/getChildrenMenu",{code})
}

export function insert(model){
    return post('menu',model)
}

export function update(model){
    return put('menu',model)
}

export function deleteMenu(Id){
    return new Promise((resolve, reject) => {
        service.delete('menu/'+Id)
            .then(res => {
                resolve(res.data)
            })
            .catch(err => {
                reject(err)
            })
    })
}

export function getAllList(){
    return get('/menu/alllist');
}
